/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package socketproject;

/**
 *
 * @author osadellah
 */
public class TCPClient implements Runnable {
    
    private String address;
    private Thread runner;          // Thread object that this class runs in
    long startTime;                 // record start time of run()
    long endTime;                   // record end time of run()
    
    public TCPClient(String faddress) {
        this.address = faddress;    // set TCPClient address
        
        if (null == runner) {
            runner = new Thread(this);
            runner.start();         // call run()
        }
    }
    
    public void run() {
        startTime = System.nanoTime();  // start a timer to record run time
        // getData() from address
    }
    
    private void getData(String address) {
        // create connection from address
        // open connection [connection.connect()]
        // get InputStream from connection
        // assign InputStream to BufferedReader
        
        String data="";
        do {
            // read data from buffer [data = buffer.readLine();]
            // append data to local file
        } while (data != null);
        
        endTime = System.nanoTime();    // cancel timer to record run time
        // print local file
    }
    
    private void printData() {
        // print file
        // print run time
        long runTime = endTime - startTime; // calculate run time
        System.out.println("Total execution time: " + runTime);
    }
    
    private static String addressF1 = "";   // address of default f1
    private static String addressF2 = "";   // address of default f2

    /**
     * @param args the command line arguments
     */
    
}